package com.yyfax.account.dao;

import com.yyfax.account.domain.AccountTrade;
import com.yyfax.account.vo.TradeSummary;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AccountTradeDao {

	/**
	 * @mbggenerated
	 */
	int insert(@Param("record") AccountTrade record, @Param("segment") String segment);

	/**
	 * @mbggenerated
	 */
	AccountTrade selectByPrimaryKey(Integer id);

	/**
	 * 根据外部订单查询订单信息
	 * 
	 * @author maojian
	 * @date 2017-09-21 11:39:50
	 * @since v1.0.0
	 * @param outTradeNo
	 * @param segment
	 * @return
	 */
	AccountTrade queryOrderByOutTradeNo(@Param("outTradeNo") String outTradeNo, @Param("segment") String segment);

	/**
	 * 根据唯一主键查询订单信息
	 *
	 * @author liangqm
	 * @date 2017-11-04 11:39:50
	 * @since v1.0.0
	 * @param outTradeNo
	 * @param segment
	 * @return
	 */
	AccountTrade queryAccountTradeByUniqueKey(@Param("tradeNo") String tradeNo, @Param("outTradeNo") String outTradeNo,
											  @Param("segment") String segment);

	/**
	 * 根据账户号和时间统计交易订单
	 *
	 * @author maojian
	 * @date 2017-09-21 11:39:53
	 * @since v1.0.0
	 * @param accountNo
	 * @param beginDate
	 * @param endDate
	 * @param segment
	 * @return
	 */
	TradeSummary queryTradeSumByDate(@Param("accountNo") String accountNo, @Param("beginDate") String beginDate, @Param("endDate") String endDate,
									 @Param("segment") String segment);

	/**
	 * 根据账户号和时间批量统计交易订单
	 *
	 * @author maojian
	 * @date 2017-09-21 11:39:53
	 * @since v1.0.0
	 * @param userIdSet
	 * @param beginDate
	 * @param endDate
	 * @param segment
	 * @return
	 */
	List<TradeSummary> batchQueryTradeSumByDate(@Param("segmentUserList") List<String> userIdSet, @Param("beginDate") String beginDate,
												@Param("endDate") String endDate, @Param("segment") String segment);

	/**
	 * 根据账户号和截止时间统计交易订单
	 * 
	 * @author maojian
	 * @date 2017-09-21 11:39:56
	 * @since v1.0.0
	 * @param accountNo
	 * @param endDate
	 * @param segment
	 * @return
	 */
	long queryTradeSumUntilDate(@Param("accountNo") String accountNo, @Param("endDate") String endDate, @Param("segment") String segment);

}